package com.byq.mm.smartlib.engine;

import android.content.Context;

import com.byq.mm.abstractx.engine.CoreEngine;
import com.byq.mm.common.engine.XmppEngine;
import com.byq.mm.smartlib.connection.LoginManager;

public class AndroidSmartEngine {

	LiteStore liteStore;
	AndroidEventCenter eventCenter;
	AndroidAccountManager accountManager;

	LoginManager loginManager;
	public AndroidAccountManager getAccountManager() {
		return accountManager;
	}
	public XmppEngine getXmppEngine() {
		return xmppEngine;
	}
	public CoreEngine getCoreEngine() {
		return coreEngine;
	}
	XmppEngine xmppEngine;
	CoreEngine coreEngine;

	public AndroidSmartEngine(Context ctx,NotificationHandler nh) {
		loginManager = new LoginManager(ctx);
		liteStore = new LiteStore(ctx);
		eventCenter = new AndroidEventCenter(ctx, nh);
		accountManager = new AndroidAccountManager(ctx);
		
		xmppEngine = new XmppEngine(liteStore, accountManager, eventCenter);
		coreEngine = new CoreEngine(liteStore, accountManager,eventCenter);
		link();
	}
	public LoginManager getLoginManager() {
		return loginManager;
	}
	void link(){
		coreEngine.setExtensionManager(xmppEngine.getExtensionManager());
		xmppEngine.setDefinationProcessor(coreEngine.getDefinationProcessor());
		xmppEngine.setInteractionProcessor(coreEngine.getInteractionProcessor());
	}

}
